const Fly = require('flyio/dist/npm/wx')
const fly = new Fly()

// 添加拦截器
// fly.interceptors.request.use((config, promise) => {
//   // 给所有请求添加自定义header
//   config.headers['content-type'] = 'application/x-www-form-urlencoded'
//   return config
// })

// 添加响应拦截器，响应拦截器会在then / catch处理之前执行
fly.interceptors.response.use(
  (response, promise) => {
    return response.data
  },
  (err, promise) => {
    console.log(err)
  }
)
import {clientUrl} from './env'

export const topic = params => {
  return fly.get(`${clientUrl}/topics`, (params))
}

export const topicCollect = (params, id) => {
  return fly.get(`${clientUrl}/topic_collect/${id}`, (params))
}

export const userId = (params, id) => {
  return fly.get(`${clientUrl}/user/${id}`, (params))
}

export const topicId = (params, id) => {
  return fly.get(`${clientUrl}/topic/${id}`, (params))
}
